<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="p" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<head>
<meta charset="UTF-8">
<%@ include file="/common/taglibs.jsp" %>	
</head>
<body style="margin:0;padding:0">
	<div id="cc" class="easyui-layout"  data-options="fit:true">
     <%--查询条件--%>
		<div id="tb" style="padding: 10px;">
	        <form id="sform" method="post">
	            <input name="wfds" id="wfds" class="easyui-searchbox"
	                data-options="prompt:'请输入行政区，街镇，姓名，身份证号...',searcher:doSearch"
	                style="width: 33%">
	               <a href="#" class="easyui-linkbutton"
	             		iconCls="icon-add" plain="true" onclick="showWin('win','${ctx}/SysRole/addRole');">新增</a>
	               <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-edit" 
					plain="true" onclick="edit('dg','win','${ctx}/SysRole/addRole');">修改</a>
	               <a href="#" class="easyui-linkbutton"
	              		iconCls="icon-remove" plain="true" onclick="del('dg','${ctx}/SysRole/delete')">删除</a>
	              <a href="#" class="easyui-linkbutton"
	              		iconCls="icon-bdel" plain="true" onclick="batchDel('dg','${ctx}/SysRole/batchDel')">批量删除</a>
	        </form>
		 	<div id="winselect" class="easyui-window" title="账号选择"
	                      data-options="iconCls:'icon-add',collapsible:false,minimizable:false,maximizable:false,modal:true,closed:true"
	                      style="width: 800px; height: 400px; padding: 0px;"></div> 
		    <div id="win" class="easyui-window" title="角色信息"
		        data-options="iconCls:'${icon}',collapsible:false,minimizable:false,maximizable:false,modal:true,closed:true"
		        style="width: 600px; height: 350px;"></div>
	    </div>
		 <%--查询条件--%>
			
		<%--查询结果列表--%>
		<table class="easyui-datagrid" id="dg" style="width: 100%; height: 100%; padding: 0px;"
	        data-options="
	                border:false,
	                rownumbers:true,
	                singleSelect:false,
	                autoRowHeight:false, 
	                pagination:true,
	                toolbar:'#tb',
	                url:'${ctx }/SysRole/queryAll',
	                pageSize:20">
			<thead>
				<tr>
					<th data-options="field:'ck',checkbox:true"></th>
	              		<th field="id" hidden=true>id</th>
	                   <th  field="name" width="15%">角色名称</th>
	                   <th  field="remark" width="20%">描述</th>
	                    <!--  <th  field="sysRoleRelates" width="60%" formatter=formatUser>账号信息</th> -->
				</tr>
			</thead>
		</table>
     	<%--查询结果列表完--%>   
    </div>
</body>
<script>
function doSearch(value,name) {
    $('#dg').datagrid({
        queryParams : $('#sform').serializeObject()
    });
}
function formatUser(val, row){
	var str = "";
	for(i =0;i<val.length;i++){
		if (val[i].sysUserInfo)
		    str += val[i].sysUserInfo.name+","
	};
	str = str.substr(0,str.length-1);
	return str;
}

</script>

